package com.report.constant;

import java.util.HashMap;
import java.util.Map;

public class MappingConstant {

    public static final String VOUCHER_TABLE = "凭证表";
    public static final String SUBJECT_BALANCE_TABLE = "科目余额表";
    public static final String ACCOUNTING_PROJECT_BALANCE_TABLE = "核算项目余额表";
    public static final String ACCOUNTING_PROJECT_DETAIL_TABLE = "核算项目明细";

    /**
     * 凭证表 字段映射关系
     */
    private static Map<String, String> voucherMapping() {
        Map<String, String> mapping = new HashMap<>();
        mapping.put("凭证日期", "voucherDate");
        mapping.put("会计月份", "accountingMonth");
        mapping.put("凭证类型", "voucherType");
        mapping.put("凭证编号", "voucherNumber");
        mapping.put("分录序号", "entrySequence");
        mapping.put("摘要", "summary");
        mapping.put("科目编号", "accountCode");
        mapping.put("科目名称", "accountName");
        mapping.put("借方发生额", "debitAmount");
        mapping.put("贷方发生额", "creditAmount");
        mapping.put("发生额方向", "amountDirection");
        mapping.put("发生金额", "amount");
        mapping.put("借方数量", "debitQuantity");
        mapping.put("贷方数量", "creditQuantity");
        mapping.put("发生数量", "quantity");
        mapping.put("借方外币发生额", "debitForeignCurrencyAmount");
        mapping.put("贷方外币发生额", "creditForeignCurrencyAmount");
        mapping.put("外币发生金额", "foreignCurrencyAmount");
        mapping.put("附件张数", "attachmentCount");
        mapping.put("计量单位", "unitOfMeasurement");
        mapping.put("外币名称", "currencyName");
        return mapping;
    }

    /**
     * 科目余额表 字段映射关系
     */
    private static Map<String, String> subjectBalanceMapping() {
        Map<String, String> mapping = new HashMap<>();
        mapping.put("科目编号", "accountCode");
        mapping.put("科目名称", "accountName");
        mapping.put("借贷方向", "debitCreditDirection");
        mapping.put("科目级次", "accountLevel");
        mapping.put("科目类别", "accountCategory");
        mapping.put("期初金额", "openingAmount");
        mapping.put("期初数量", "openingQuantity");
        mapping.put("期初外币", "openingForeignCurrency");
        mapping.put("计量单位", "unitOfMeasurement");
        mapping.put("外币名称", "currencyName");
        mapping.put("期初借方金额", "openingDebitAmount");
        mapping.put("期初贷方金额", "openingCreditAmount");
        mapping.put("期初借方数量", "openingDebitQuantity");
        mapping.put("期初贷方数量", "openingCreditQuantity");
        mapping.put("期初借方外币", "openingDebitForeignCurrency");
        mapping.put("期初贷方外币", "openingCreditForeignCurrency");
        mapping.put("借方发生额", "debitAmount");
        mapping.put("贷方发生额", "creditAmount");
        return mapping;
    }

    /**
     * 核算项目余额表 字段映射关系
     */
    private static Map<String, String> accountingProjectBalanceMapping() {
        Map<String, String> mapping = new HashMap<>();
        mapping.put("科目编号", "accountCode");
        mapping.put("科目名称", "accountName");
        mapping.put("核算项目类型编号", "projectTypeCode");
        mapping.put("核算项目类型名称", "projectTypeName");
        mapping.put("核算项目编号", "projectCode");
        mapping.put("核算项目名称", "projectName");
        mapping.put("借贷方向", "debitCreditDirection");
        mapping.put("期初金额", "openingAmount");
        mapping.put("期初借方金额", "openingDebitAmount");
        mapping.put("期初贷方金额", "openingCreditAmount");
        mapping.put("期初借方数量", "openingDebitQuantity");
        mapping.put("期初贷方数量", "openingCreditQuantity");
        mapping.put("期初借方外币", "openingDebitForeignCurrency");
        mapping.put("期初贷方外币", "openingCreditForeignCurrency");
        mapping.put("期初数量", "openingQuantity");
        mapping.put("期初外币", "openingForeignCurrency");
        mapping.put("计量单位", "unitOfMeasurement");
        mapping.put("外币名称", "currencyName");
        mapping.put("余额行号", "balanceRowNumber");
        return mapping;
    }

    /**
     * 核算项目明细 字段映射关系
     */
    private static Map<String, String> accountingProjectDetailMapping() {
        Map<String, String> mapping = new HashMap<>();
        mapping.put("凭证日期", "voucherDate");
        mapping.put("会计月份", "accountingMonth");
        mapping.put("凭证类型", "voucherType");
        mapping.put("凭证编号", "voucherNumber");
        mapping.put("分录序号", "entrySequence");
        mapping.put("摘要", "summary");
        mapping.put("科目编号", "accountCode");
        mapping.put("科目名称", "accountName");
        mapping.put("借方发生额", "debitAmount");
        mapping.put("贷方发生额", "creditAmount");
        mapping.put("发生额方向", "amountDirection");
        mapping.put("发生金额", "amount");
        mapping.put("借方数量", "debitQuantity");
        mapping.put("贷方数量", "creditQuantity");
        mapping.put("发生数量", "quantity");
        mapping.put("借方外币发生额", "debitForeignCurrencyAmount");
        mapping.put("贷方外币发生额", "creditForeignCurrencyAmount");
        mapping.put("外币发生金额", "foreignCurrencyAmount");
        mapping.put("附件张数", "attachmentCount");
        mapping.put("计量单位", "unitOfMeasurement");
        mapping.put("外币名称", "currencyName");
        mapping.put("核算项目类型编号", "projectTypeCode");
        mapping.put("核算项目类型名称", "projectTypeName");
        mapping.put("核算项目编号", "projectCode");
        mapping.put("核算项目名称", "projectName");

        return mapping;
    }

    public static Map<String, Map<String, String>> mappings() {
        Map<String, Map<String, String>> allMappings = new HashMap<>();
        allMappings.put(VOUCHER_TABLE, voucherMapping());
        allMappings.put(SUBJECT_BALANCE_TABLE, subjectBalanceMapping());
        allMappings.put(ACCOUNTING_PROJECT_BALANCE_TABLE, accountingProjectBalanceMapping());
        allMappings.put(ACCOUNTING_PROJECT_DETAIL_TABLE, accountingProjectDetailMapping());
        return allMappings;
    }
}
